package com.chenfan.process.entity.po;

import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;

import java.util.Date;

/**
 * @author liuming
 * @date 2021/11/1
 */
@Data
@TableName(value = "process_transfer_log_detail")
public class TransferLogDetailPo {

    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;
    @JsonSerialize(using = ToStringSerializer.class)
    private Long transferId;
    @JsonSerialize(using = ToStringSerializer.class)
    private Long approvalId;
    @JsonSerialize(using = ToStringSerializer.class)
    private Long approvalTemplateId;
    private String approvalTemplateName;
    @JsonSerialize(using = ToStringSerializer.class)
    private Long businessId;
    private String businessCode;
    private Date createTime;

    public static TransferLogDetailPo ofDefault(ApprovalPo approvalPo, ApprovalTemplatePo approvalTemplatePo) {
        TransferLogDetailPo transferLogDetailPo = new TransferLogDetailPo();
        transferLogDetailPo.setApprovalId(approvalPo.getApprovalId());
        transferLogDetailPo.setBusinessId(approvalPo.getBusinessId());
        transferLogDetailPo.setBusinessCode(approvalPo.getBusinessCode());
        transferLogDetailPo.setApprovalTemplateId(approvalPo.getApprovalTemplateId());
        transferLogDetailPo.setApprovalTemplateName(approvalTemplatePo.getTitle());
        return transferLogDetailPo;
    }
}
